package com.catmiw.swt;

import java.util.ArrayList;
import java.util.List;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

import com.catmiw.wyz.util.ExcelUtils;

public class Test {
	public static void loadNewWordList(){
		Workbook wb = ExcelUtils.getWorkbook("D:/studyassist/config/英语单词短语句型.xls");
		Sheet sheet = wb.getSheet("单词");
		
		List<NewWord> newwords=new ArrayList<NewWord>();
		
		for (int i=1;i<65525;i++){
			Row row=sheet.getRow(i);
			if (row==null)
				break;
			Cell cell=row.getCell(2);
			if (cell==null)
				continue;
			String temp=cell.getStringCellValue();
			if (temp==null||"".equals(temp))
				continue;
			NewWord nw=new NewWord();
			nw.setWord(temp);
			newwords.add(nw);
			
			cell=row.getCell(0);
			if (cell==null)
				continue;
			nw.setBook(cell.getStringCellValue());
			
			cell=row.getCell(1);
			if (cell==null)
				continue;
			nw.setUnit((int)(cell.getNumericCellValue()));
			
			cell=row.getCell(3);
			if (cell==null)
				continue;
			nw.setRequire((int)(cell.getNumericCellValue()));
			
			cell=row.getCell(4);
			if (cell==null)
				continue;
			nw.setMeans(cell.getStringCellValue());

		}
		System.out.println(newwords);
	}
	public static void main(String[] args) {
		loadNewWordList();

	}

}
